cmake_minimum_required(VERSION 3.8)
project(hello_world_cpp)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# 查找依赖包
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)

# 添加可执行文件
add_executable(hello_node src/hello_node.cpp)

# 指定可执行文件的依赖
ament_target_dependencies(hello_node
  rclcpp
)

# 安装可执行文件到install目录
install(TARGETS
  hello_node
  DESTINATION lib/${PROJECT_NAME}
)

if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  set(ament_cmake_copyright_FOUND TRUE)
  set(ament_cmake_cpplint_FOUND TRUE)
  ament_lint_auto_find_test_dependencies()
endif()

ament_package()
    